const connection = require("../db")
class articleServer {
  add(title, cate_id, content, state, cover_img, author_id) {
    const statement =
      "insert into articles (title,cate_id,content,pub_date,state, cover_img,author_id) values(?,?,?,?,?,?,?)"
    return connection.execute(statement, [
      title,
      cate_id,
      content,
      new Date(),
      state,
      cover_img,
      author_id,
    ])
  }
}

module.exports = new articleServer()
